﻿@ModelType IEnumerable(Of Microsoft.Samples.WindowsPhoneCloud.Web.Models.UserModel)
@Code
    ViewData("Title") = "Microsoft Push Notifications"
End Code
<h2>
    Microsoft Push Notifications</h2>
<p>
    You can send Microsoft Push Notifications to the following users:</p>
<table>
    <tr>
        <th class="left-aligned">
            User
        </th>
        <th>
            Notification
        </th>
        <th>
            Commands
        </th>
    </tr>
    @Code
        Dim i = 0
    End Code
    @For Each userModel In Me.Model
        Dim containerId = Guid.NewGuid()
        i = i + 1
        @<tr class="d@( (i Mod 2))">
            <td class="left-aligned">
                @( userModel.UserName)
            </td>
            <td class="PushNotificationTextColumn">
                <input type="text" id="Push_@( containerId)_Message" maxlength="512" />
                <div class="notification-status">
                    <img class="sending hidden" id="Push_@( containerId)_Sending" src="/Content/images/sending.gif" alt="Sending push notification" />
                    <span id="Push_@( containerId)_Result"></span>
                </div>
            </td>
            <td class="PushNotificationSendColumn">
                <a class="send-actions" onclick="SendMicrosoftNotification('@( containerId)', '@( userModel.UserId)', toastActionUrl)">
                    Send Toast</a> <a class="send-actions" onclick="SendMicrosoftNotification('@( containerId)', '@( userModel.UserId)', tileActionUrl)">
                        Send Tile</a> <a class="send-actions" onclick="SendMicrosoftNotification('@( containerId)', '@( userModel.UserId)', rawActionUrl)">
                            Send Raw</a>
            </td>
        </tr>
    Next
</table>
<script type="text/javascript">
//<![CDATA[
    var toastActionUrl = '@Me.Html.Raw(Me.Url.Action("SendMicrosoftToast", New With {Key .userId = "_user_", Key .message = "_message_"}))';
    var tileActionUrl = '@Me.Html.Raw(Me.Url.Action("SendMicrosoftTile", New With {Key .userId = "_user_", Key .message = "_message_"}))';
    var rawActionUrl = '@Me.Html.Raw(Me.Url.Action("SendMicrosoftRaw", New With {Key .userId = "_user_", Key .message = "_message_"}))';
//]]>
</script>
